package com.shuqi.model.parse.parser;

import java.util.ArrayList;
import java.util.List;

import org.xml.sax.Attributes;
import org.xml.sax.SAXException;

import com.shuqi.model.bean.SearchAssociateInfo;
import com.shuqi.model.parse.HandlerBase;

/**
 * 搜索联想文件解析
 * 
 * @author linyuren
 * 
 */
public class SearchAssociateParser extends HandlerBase {

    private List<SearchAssociateInfo> searchAssociateInfoList;// 搜索联想的集合
    private SearchAssociateInfo searchAssociateInfo; // 搜索联想对象

    @Override
    public List<SearchAssociateInfo> getParsedData() {
        return searchAssociateInfoList;
    }

    @Override
    public void startDocument() throws SAXException {
        this.searchAssociateInfoList = new ArrayList<SearchAssociateInfo>();
    }

    @Override
    public void startElement(String uri, String localName, String qName, Attributes attrs)
            throws SAXException {
        if (localName.equals("item")) {
            this.searchAssociateInfo = new SearchAssociateInfo();
            this.searchAssociateInfo.setTitle(isNull(attrs, "title"));
            this.searchAssociateInfoList.add(this.searchAssociateInfo);
        }
    }

    @Override
    public void endDocument() throws SAXException {
        super.endDocument();
    }

}
